feat: Make CREATE EXTENSION tests optional#92
Merged
gbartolini merged 7 commits intocloudnative-pg:mainfrom Feb 12, 2026
Merged
feat: Make CREATE EXTENSION tests optional#92gbartolini merged 7 commits intocloudnative-pg:mainfrom
gbartolini merged 7 commits intocloudnative-pg:mainfrom
Conversation
8eef786 to
0c185f5
Compare
mbiagetti
commented
Jan 29, 2026
60a3587 to
26b1448
Compare
NiccoloFei
approved these changes
Feb 5, 2026
GabriFedi97
approved these changes
Feb 9, 2026
cc2f50c to
b055ea9
Compare
gbartolini
reviewed
Feb 9, 2026
Contributor
|
I have tried this patch using an extension that doesn't need apiVersion: postgresql.cnpg.io/v1
kind: Database
metadata:
name: (join('-', [$values.name, 'app']))
spec:
name: app
owner: app
cluster:
name: ($values.name)
extensions: ($values.database_config.extensions_spec)In my opinion, this test should be skipped or, if we want to, we should use a template that adds the |
mnencia
approved these changes
Feb 11, 2026
e0af6c6 to
f0b02a0
Compare
Contributor
|
@mnencia it is not working for me. If I run: task e2e:test:full TARGET=wal2jsonI used this basic Dockerfile: # SPDX-FileCopyrightText: Copyright © contributors to CloudNativePG, established as CloudNativePG a Series of LF Projects, LLC.
# SPDX-License-Identifier: Apache-2.0
ARG BASE=ghcr.io/cloudnative-pg/postgresql:18-minimal-trixie
FROM $BASE AS builder
ARG PG_MAJOR
ARG EXT_VERSION
USER 0
RUN apt-get update && apt-get install -y --no-install-recommends \
"postgresql-${PG_MAJOR}-wal2json=${EXT_VERSION}"
FROM scratch
ARG PG_MAJOR
# Licenses
# COPY --from=builder /usr/share/doc/postgresql-${PG_MAJOR}-wal2json/copyright /licenses/postgresql-${PG_MAJOR}-wal2json/
# Libraries
# COPY --from=builder /usr/lib/postgresql/${PG_MAJOR}/lib/wal2json* /lib/
USER 65532:65532And this metadata: # SPDX-FileCopyrightText: Copyright © contributors to CloudNativePG, established as CloudNativePG a Series of LF Projects, LLC.
# SPDX-License-Identifier: Apache-2.0
metadata = {
name = "wal2json"
sql_name = "wal2json"
image_name = "wal2json"
shared_preload_libraries = []
extension_control_path = []
dynamic_library_path = []
ld_library_path = []
auto_update_os_libs = false
required_extensions = []
create_extension = false
versions = {
trixie = {
// renovate: suite=trixie-pgdg depName=postgresql-18-wal2json
"18" = "2.6-3.pgdg13+1"
}
bookworm = {
// renovate: suite=bookworm-pgdg depName=postgresql-18-wal2json
"18" = "2.6-3.pgdg12+1"
}
}
}I get this result: [e2e:test-wal2json] | 03:48:54 | verify-extension | Create a Cluster with the extension | ASSERT | ERROR | postgresql.cnpg.io/v1/Database @ chainsaw-innocent-toucan/wal2json-app
[e2e:test-wal2json] === ERROR
[e2e:test-wal2json] --------------------------------------------------------------------
[e2e:test-wal2json] postgresql.cnpg.io/v1/Database/chainsaw-innocent-toucan/wal2json-app
[e2e:test-wal2json] --------------------------------------------------------------------
[e2e:test-wal2json] * status.extensions: Required value: field not found in the input object
[e2e:test-wal2json]
[e2e:test-wal2json] --- expected
[e2e:test-wal2json] +++ actual
[e2e:test-wal2json] @@ -5,6 +5,5 @@
[e2e:test-wal2json] namespace: chainsaw-innocent-toucan
[e2e:test-wal2json] status:
[e2e:test-wal2json] applied: true
[e2e:test-wal2json] - extensions: null
[e2e:test-wal2json] observedGeneration: 1
[e2e:test-wal2json] | 03:48:54 | verify-extension | Create a Cluster with the extension | TRY | END |
[e2e:test-wal2json] | 03:48:54 | verify-extension | Create a Cluster with the extension | CLEANUP | BEGIN |
[e2e:test-wal2json] | 03:48:54 | verify-extension | Create a Cluster with the extension | DELETE | OK | postgresql.cnpg.io/v1/Database @ chainsaw-innocent-toucan/wal2json-app
[e2e:test-wal2json] | 03:48:54 | verify-extension | Create a Cluster with the extension | DELETE | OK | postgresql.cnpg.io/v1/Cluster @ chainsaw-innocent-toucan/wal2json
[e2e:test-wal2json] | 03:48:54 | verify-extension | Create a Cluster with the extension | CLEANUP | END |
[e2e:test-wal2json] | 03:48:54 | verify-extension | @chainsaw | CLEANUP | BEGIN |
[e2e:test-wal2json] | 03:48:54 | verify-extension | @chainsaw | DELETE | OK | v1/Namespace @ chainsaw-innocent-toucan
[e2e:test-wal2json] | 03:49:04 | verify-extension | @chainsaw | CLEANUP | END |
[e2e:test-wal2json] --- FAIL: chainsaw (0.00s)
[e2e:test-wal2json] --- FAIL: chainsaw/verify-extension (209.20s)
[e2e:test-wal2json] FAIL
[e2e:test-wal2json] Tests Summary...
[e2e:test-wal2json] - Passed tests 0
[e2e:test-wal2json] - Failed tests 1
[e2e:test-wal2json] - Skipped tests 0
[e2e:test-wal2json] Done with failures.
[e2e:test-wal2json] Stderr:
[e2e:test-wal2json] Error: some tests failed
task: [e2e:test:full] rm -f "./kubeconfig"
task: [e2e:test:full] rm -f "wal2json/values.yaml"
task: [e2e:test:full] rm -f "wal2json/bake-metadata.json"
task: Failed to run task "e2e:test:full": task: Failed to run task "e2e:test": exit status 1
... |
Signed-off-by: Matteo <matteo.biagetti@enterprisedb.com>
Signed-off-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
Signed-off-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
TestingValues was missing the CreateExtension field, so the generated values.yaml never contained create_extension and the psql verification job always skipped. Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Bundle extension metadata with its configuration so generateDatabaseConfig no longer re-parses metadata or re-fetches image annotations for each extension. Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Skip extensions with create_extension = false from the Database CR and status assertion entirely, rather than listing them with ensure: absent. Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
f0b02a0 to
48ada15
Compare
Member
|
Sorry Gabriele. I missed pushing the last version of the code. I apologize for the time wasted. |
gbartolini
approved these changes
Feb 12, 2026
Contributor
|
No worries, that's ok. Now everything works! |
mbiagetti
added a commit
to mbiagetti/postgres-extensions-containers
that referenced
this pull request
Feb 23, 2026
Adds a `create_extension` boolean field to extension metadata so that extensions providing only libraries or tools (e.g. wal2json) can skip `CREATE EXTENSION` tests. When `create_extension` is `false`, the extension is omitted entirely from the Database CR's `extensions_spec` and the status assertion skips the `extensions` field. The generated `database_assert_status` map conditionally includes or excludes the `extensions` key, avoiding the Chainsaw limitation where `extensions: null` would require the field to exist in the actual resource. The psql verification job in `check-extension.yaml` also reads `create_extension` and skips when false. Closes cloudnative-pg#85 Signed-off-by: Matteo <matteo.biagetti@enterprisedb.com> Signed-off-by: Niccolò Fei <niccolo.fei@enterprisedb.com> Signed-off-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com> Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com> Co-authored-by: Niccolò Fei <niccolo.fei@enterprisedb.com> Co-authored-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com> Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
create_extensionboolean field to extension metadata so that extensions providing only libraries or tools (e.g. wal2json) can skipCREATE EXTENSIONtests. Whencreate_extensionisfalse, the extension is omitted entirely from the Database CR'sextensions_specand the status assertion skips theextensionsfield.The generated
database_assert_statusmap conditionally includes or excludes theextensionskey, avoiding the Chainsaw limitation whereextensions: nullwould require the field to exist in the actual resource. The psql verification job incheck-extension.yamlalso readscreate_extensionand skips when false.Example generated values for
create_extension: true(pgvector):Example generated values for
create_extension: false(wal2json):Closes #85